package com.ls.pattern.adapter.v1;

import com.ls.pattern.adapter.PassportService;
import com.ls.pattern.adapter.ResultMsg;

/**
 * 三方登录适配器
 *
 * @author 挥之以墨
 */
public class PassportThirdAdapter extends PassportService implements IPassportThird {

    @Override
    public ResultMsg loginForqq(String openid) {
        return loginForRegister(openid, null);
    }

    @Override
    public ResultMsg loginForWeChat(String openid) {
        return loginForRegister(openid, null);
    }

    private ResultMsg loginForRegister(String username, String password) {
        if (null == password) {
            password = "THIRD_EMPTY";
        }
        super.regist(username, password);
        return super.login(username, password);
    }
}
